{% extends 'generic/object_edit.html' %}
{% load static %}
{% load form_helpers %}

{% block form %}
  <div class="field-group my-5">
    <div class="row mb-2">
      <h5 class="offset-sm-3">Circuit Termination</h5>
    </div>
    {% render_field form.provider %}
    {% render_field form.circuit %}
    {% render_field form.term_side %}
    {% render_field form.tags %}
    {% render_field form.mark_connected %}
    {% with providernetwork_tab_active=form.initial.provider_network %}
      <div class="row mb-2">
        <div class="offset-sm-3">
          <ul class="nav nav-pills" role="tablist">
            <li class="nav-item" role="presentation">
              <button class="nav-link{% if not providernetwork_tab_active %} active{% endif %}" role="tab" type="button" data-bs-target="#site" data-bs-toggle="tab">Site</button>
            </li>
            <li class="nav-item" role="presentation">
              <button class="nav-link{% if providernetwork_tab_active %} active{% endif %}" role="tab" type="button" data-bs-toggle="tab" data-bs-target="#providernetwork">Provider Network</button>
            </li>
          </ul>
        </div>
      </div>
      <div class="tab-content p-0 border-0">
        <div class="tab-pane{% if not providernetwork_tab_active %} active{% endif %}" id="site">
          {% render_field form.region %}
          {% render_field form.site_group %}
          {% render_field form.site %}
        </div>
        <div class="tab-pane{% if providernetwork_tab_active %} active{% endif %}" id="providernetwork">
          {% render_field form.provider_network %}
        </div>
      </div>
    {% endwith %}
  </div>

  <div class="field-group my-5">
    <div class="row mb-2">
      <h5 class="offset-sm-3">Termination Details</h5>
    </div>
    {% render_field form.port_speed %}
    {% render_field form.upstream_speed %}
    {% render_field form.xconnect_id %}
    {% render_field form.pp_info %}
    {% render_field form.description %}
  </div>

  {% if form.custom_fields %}
    <div class="field-group mb-5">
      <div class="row mb-2">
        <h5 class="offset-sm-3">Custom Fields</h5>
      </div>
      {% render_custom_fields form %}
    </div>
  {% endif %}
{% endblock %}
